%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% A function to generate 2D golden-angle radial trajectory
% Used for GROG recon only

%Li Feng, NYU, 12/18/2017

function Traj=Trajectory_GoldenAngle_GROG_N_mod(ntviews,nx,N,offset,modType);

tau = (1.0+sqrt(5.0))/2.0;
golden_angle = pi / (tau+N-1);
a=180/golden_angle;
radian = mod((0:golden_angle:(ntviews-1)*golden_angle)+offset,modType);
Rho=[-floor(nx/2):floor(nx/2)];
Rho=Rho(1:nx)+0.5;
% Rho=linspace(-(nx/2),nx/2,nx);

for jj=1:size(radian,2)
    X(:,jj)=Rho*sin(radian(1,jj));
    Y(:,jj)=-Rho*cos(radian(1,jj));
end

Traj=X+i*Y;
return